package kuzha.ast;

public class IfStatement extends BlockStatement {
	public final IfStatementTest[] clauses;
	public final Statement _else;
	
	public IfStatement(Expression cond, Statement _then, Statement _else) {
		this(new IfStatementTest[]{ new IfStatementTest(cond, _then) }, _else);
	}
	public IfStatement(IfStatementTest[] clauses, Statement _else) {
		super();
		if (clauses == null || clauses.length == 0)
			throw new IllegalArgumentException();
		this.clauses = clauses.clone();
		this._else = _else;
	}
	
	@Override
	public void accept(AstVisitor visitor) {
		visitor.visit(this);
	}
	@Override
	public <A, R> R accept(AstVisitor2<A, R> visitor, A object) {
		return visitor.visit(this, object);
	}
}
